<template>
  <div class="custom-content">
    <div
      v-if="
        setting.query !== undefined &&
          setting.query !== null &&
          setting.query.length > 0
      "
      class="custom-header"
    >
      <div
        v-for="(item, index) in setting.query"
        :key="'input-' + index"
        class="header-input"
      >
        <div class="header-input-span">
          <input
            v-if="item.type === 1"
            v-model="form[item.column]"
            placeholder="请输入查询内容"
            @keyup="queryObject"
          >&nbsp;&nbsp;&nbsp;
          <div class="header-input-icon" @click="queryObject">
            <i class="el-icon-search" />
          </div>
        </div>
      </div>
    </div>
    <div class="custom-body">
      <el-scrollbar
        style="width: 100%;height: 100%;overflow-x: hidden;overflow-y: auto"
      >
        <el-empty
          v-if="dataList === null || dataList.length === 0"
          :image-size="100"
        />
        <div v-else class="custom-ul">
          <div
            v-for="(obj, index) in dataList"
            :key="'obj-' + index"
            class="custom-ul-li"
            :loading="loading"
            @click="openEntity(obj)"
          >
            <div class="custom-li-left">
              {{ obj[column['time']] }}
              <div class="custom-left-span">
                {{ obj[column['title']].substring(0, 1) }}
              </div>
            </div>
            <div class="custom-li-right">
              <div class="custom-li-title">{{ obj[column['title']] }}
              </div>
              <div class="custom-li-span">
                <span>{{ obj[column['left']] }}</span>
                <span>{{ obj[column['right']] }}</span>
              </div>
              <div class="right-more"><i class="el-icon-d-arrow-right" /></div>
            </div>
          </div>
          <div class="custom-loading-more">
            <el-button
              v-if="isLoading === true"
              type="text"
              :loading="moreLoading"
              @click="loadingMore"
            >加载更多</el-button>
            <div v-else class="loading-none">没有更多数据</div>
          </div>
        </div>
      </el-scrollbar>
    </div>
  </div>
</template>

<script>
import { more } from '@/mixins/mobile'
export default {
  name: 'AppNewListTempV1',
  mixins: [more({})]
}
</script>

<style lang="scss" scoped>
.custom-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-flow: column nowrap;
}
.custom-header {
  flex: 0 1 auto;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  background-color: #f2f6fc;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
}
.custom-body {
  position: absolute;
  top: 80px;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  overflow: hidden;
  padding: 0 10px;
  box-sizing: border-box;
  background-color: #ffffff;
}
.header-input-span > input {
  width: 100%;
  border: none;
  outline: none;
}
.header-input {
  width: 100%;
  line-height: 40px;
  height: 40px;
  padding: 5px 15px;
  box-sizing: border-box;
  font-size: 13px;
}
.header-input-span {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background-color: #ffffff;
  padding: 0 20px;
  box-sizing: border-box;
  position: relative;
  line-height: 30px;
  color: #606266;
}
.header-input-icon {
  position: absolute;
  right: 5px;
  top: 0;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
}
.custom-ul {
  padding-top: 10px;
  box-sizing: border-box;
}
.custom-ul-li {
  width: 100%;
  height: 60px;
  display: flex;

  .custom-li-left {
    width: 70px;
    line-height: 15px;
    font-size: 0.7rem;
    text-align: left;
    color: #909399;
    border-right: 1px dashed #C0C4CC;
    position: relative;

    .custom-left-span {
      position: absolute;
      width: 20px;
      height: 20px;
      background-color: #00a0e9;
      border-radius: 10px;
      color: #ffffff;
      line-height: 20px;
      font-size: 0.8rem;
      font-weight: bold;
      text-align: center;
      top: 0;
      right: -10px;
    }
  }

  .custom-li-right {
    flex: 1 1;
    padding-left: 12px;
    box-sizing: border-box;
    display: flex;
    flex-flow: column nowrap;
    overflow: hidden;
    position: relative;

    .custom-li-title {
      width: 100%;
      height: 30px;
      line-height: 20px;
      font-size: 0.9rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .custom-li-span {
      width: 100%;
      height: 20px;
      line-height: 20px;
      font-size: 0.8rem;
      color: #909399;
      display: flex;
      justify-content: space-between;
    }

    .right-more {
      width: 20px;
      height: 20px;
      color: #909399;
      text-align: center;
      line-height: 20px;
      position: absolute;
      right: 0;
      top: 50%;
      margin-top: -10px;
      font-size: 0.7rem;
    }
  }
}
.custom-loading-more {
  width: 100%;
  height: 30px;
  line-height: 30px;
  text-align: center;
}
.loading-none {
  font-size: 13px;
  color: #909399;
}
[class*="el-col-"] {
  float: left;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.el-scrollbar >>> .el-scrollbar__wrap {
  overflow-x: hidden;
  overflow-y: auto;
}
</style>
